#include <iostream>
#include <conio.h>
#include <cmath>

using namespace std;

double const M = 5.97219e24;	//units: kg
double const G = 6.67e-11;		//units: Nm2/kg2

void calculate_Rd(double* R, double dt, int N, double* Rd);

int main(){
	double t=1;
	int N=3;

	double test[3] = {0, 1, 1}, testd[3]= {0, 1, 1};

	cout << "Space Science Rocks!\n" << test[1] << endl<< test[2] <<endl<< testd[1] <<endl<< testd[2];
	calculate_Rd(test, t, N, testd);

	cout << "Space Science Rocks!\n" << test[1] << endl<< test[2] <<endl<< testd[1] <<endl<< testd[2];

	getch();
	return 0;

}



void calculate_Rd(double* R, double dt, int N, double* Rd){

	
	//R = vector that holds state variables
	//dt = time in seconds
	//N = number of components in vector R
	//Rd = vector that holds the derivatives of the state variables

	double dt = 1 //unit: seconds
	double m=4, F=0, r=700;
	double x, v, xd, vd, A; //x:displacement, v:velocity
	x = R[1];
	v = R[2];

	//Note: xd=dx/dt, vd=dv/dt

	A = (G*M*m)+(F*r*r)/(m*r*r*r);

	xd = v;
	vd = A*xd;

	Rd[1]=xd;
	Rd[2]=vd;  

}